package com.ferry.id.pool.domain;

import	java.util.concurrent.atomic.AtomicLong;

/**
 * Created by daiyong
 */

public class Pool {
	private AtomicLong value = new AtomicLong(0);
	private volatile long maxId;
	private volatile int step;
	private PooledBuffer pooledBuffer;

	public Pool(PooledBuffer pooledBuffer) {
		this.pooledBuffer = pooledBuffer;
	}

	public AtomicLong getValue() {
		return value;
	}

	public void setValue(AtomicLong value) {
		this.value = value;
	}

	public long getMaxId() {
		return maxId;
	}

	public void setMaxId(long maxId) {
		this.maxId = maxId;
	}

	public int getStep() {
		return step;
	}

	public void setStep(int step) {
		this.step = step;
	}

	public PooledBuffer getPooledBuffer() {
		return pooledBuffer;
	}

	public void setPooledBuffer(PooledBuffer pooledBuffer) {
		this.pooledBuffer = pooledBuffer;
	}

	public long getIdle() {
		return this.getMaxId() - getValue().get();
	}
}
